
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:massagist/models/acctravel_model_entity.dart';
import 'package:massagist/pages/acctravel_info_page.dart';

import '../generated/l10n.dart';

class AcctravelItem extends StatelessWidget {
  AcctravelModelEntity model;
  AcctravelItem({required this.model});

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      child: Container(
        height: 114.sp,
        width: double.infinity,
        padding: EdgeInsets.only(left: 12.sp, right: 12.sp, top: 12.sp),
        child: ClipRect(
          child: Row(
            children: [
              Container(
                child: ClipRRect(
                  borderRadius: BorderRadius.circular(12.sp),
                  child: Image.network(
                    model.icon,
                    width: 114.sp, height: 114.sp, fit: BoxFit.cover,
                  ),
                ),
              ),
              Container(
                margin: EdgeInsets.only(left: 12.sp),
                child: Column(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    Text(model.name, style: TextStyle(
                      color: Color(0xFF110604),
                      fontWeight: FontWeight.bold,
                      fontSize: 16.sp,
                    )),
                    Container(
                      child: Row(
                        children: [
                          Container( width: 50.sp, height: 18.sp, decoration: BoxDecoration(
                            color: Color(0xFFFF5147),
                            borderRadius: BorderRadius.circular(9.sp),
                          ),
                            alignment: Alignment.center,
                            child: Row(
                              crossAxisAlignment: CrossAxisAlignment.center,
                              children: [
                                Container(
                                  child: Image.asset("assets/images/women.png", width: 12.sp, height: 12.sp,),
                                  margin: EdgeInsets.only(left: 5.sp),
                                ),
                                Container(
                                  margin: EdgeInsets.only(left: 2.sp),
                                  child: Text(model.age, style: TextStyle(
                                    color: Colors.white,
                                    fontSize: 11.sp,
                                  )),
                                ),
                              ],
                            ),
                          ),
                          Container(
                            margin: EdgeInsets.only(left: 8.sp),
                            child: Text(model.height + " | " + model.weight, style: TextStyle(
                              color: Color(0xFF999999),
                              fontSize: 11.sp,
                            )),
                          ),
                        ],
                      ),
                    ),
                    Container(
                      height: 53.sp,
                      width: ScreenUtil().screenWidth - 175.sp,
                      padding: EdgeInsets.only(top: 5.sp),
                      child: Row(
                        children: [
                          Container(
                            width: ScreenUtil().screenWidth - 200.sp,
                            alignment: Alignment.topLeft,
                            // width: 150.0, // 外部Container的宽度
                            // padding: EdgeInsets.all(8.0), // 外部Container的内边距
                            child: Wrap(
                              spacing: 8.sp,
                              runSpacing: 8.sp,
                              children: List.generate(model.scenic.length, (index) {
                                return Container(
                                  padding: EdgeInsets.only(left: 9.sp, right: 9.sp),
                                  width: 26.sp + (model.scenic[index]).length * 13.sp,
                                  height: 20.sp,
                                  decoration: BoxDecoration(
                                    borderRadius: BorderRadius.circular(10.sp),
                                    border: Border.all(
                                      color: Color(0xFF00CA7E), width: 1.sp,
                                    ),
                                  ),
                                  child: Center(
                                    child: Text(
                                      model.scenic[index],
                                      style: TextStyle(color: Color(0xFF00CA7E), fontSize: 12),
                                    ),
                                  ),
                                );
                              }),
                            ),
                          )
                        ],
                      ),
                    ),
                  ],
                ),
              )
            ],
          ),
        ),
      ),
      onTap: () {
        Navigator.push(
          context,
          MaterialPageRoute(builder: (context) =>  AcctravelInfoPage(model: this.model,)),
        );
      },
    );
  }
}